package com.sphd.beautysalon.presenter;


import com.android.volley.VolleyError;
import com.sphd.beautysalon.view.OrdersInfoView;
import com.sphd.beautysalon.info.FoodInfo;
import com.sphd.beautysalon.model.OrdersInfoModelImpl;

import java.util.List;
import java.util.Map;

/**
* Created by Hu on 2016/12/12
*/

public class OrdersInfoPresenterImpl implements OrdersInfoPresenter {
    OrdersInfoModelImpl ordersInfoModel;
    OrdersInfoView ordersInfoView;

    public OrdersInfoPresenterImpl(OrdersInfoView ordersInfoView) {
        this.ordersInfoView = ordersInfoView;
        ordersInfoModel=new OrdersInfoModelImpl();
    }

    @Override
    public void addData(String url) {
        ordersInfoView.showLoading();
        ordersInfoModel.sendUrl(this,url);
    }

    @Override
    public void sendError(VolleyError error) {

    }

    @Override
    public void sendList(List<FoodInfo> foodInfos) {
        ordersInfoView.recList(foodInfos);
        ordersInfoView.dissLoading();
    }

    @Override
    public void recUrl(String s, Map<String, String> map) {
        ordersInfoView.showLoading();ordersInfoModel.recUrlMap(s,map,this);
    }

    @Override
    public void recRes(int res) {
        ordersInfoView.recRes(res);
        ordersInfoView.dissLoading();
    }

    @Override
    public void sendCancleUrl(String s) {
        ordersInfoView.showLoading();
        ordersInfoModel.sendCancleUrl(s,this);
    }

    @Override
    public void recCanRes(int status) {
        ordersInfoView.recCancleRes(status);
        ordersInfoView.dissLoading();
    }
}